Date ( ) Function
The date function is used to make date-based queries in SIQL. It can take either a string argument, or two dates as arguments, and return either a date range or a specific date.
Valid Syntax | Example | Return Type | Example in a SIQL Query | Return Value |
---|---|---|---|---|
'last X days' | date('last 30 days') | Date range | rule{created ~ date('last 30 days')} | All rules created between 30 days ago, and the current date. |
'before X days' | date('before 30 days') | Date range | rule{ created ~ date('before 30 days') } | All rules created before 30 days from the current date. |
'+X days' | date('+10 days') | Date | rule{ expiration ~ date('+10 days') } | All rules that expire in the next 10 days. |
'-X days' | date('-10 days') | Date range | rule{ created ~ date('-10 days') } | All rules that were created in the previous 10 days. |
'today' | date('today') | Date | rule{ expiration = date('today') } | All rules that expire on the current date. |
'today - X days' | date('today - 30 days') | Date | rule{ created > date('today - 30 days') } | All rules that wre created in the previous 30 days, including the current date. |
'today - X days' | date('today + 30 days') | Date | rule{ expiration < date('today + 30 days') } | All rules that expire 30 days in the future, including the current date. |
startdate, enddate | date(startdate, enddate) | Date range | rule{created ~ date('2013-11-01, 2013-11-30') | All rules created between the date range. |